<?php
/**
 * Created by PhpStorm.
 * User: ybjaa
 * Date: 2017/5/24
 * Time: 15:45
 */

namespace App\Business\File;


use App\Business\BusBase;
use App\Business\ReturnResult;
use App\Extend\Regex;
use App\Extend\StringEx;
use App\Models\bis_ybj_jssb_files;
use App\Models\files;
use App\Units;
use Illuminate\Support\Facades\Storage;

class ImageUpload extends FileBase
{
    protected function Handle()
    {

        //读取文件
        $result=$this->saveFile("public/images");

        if(!$result->result) return $result;

        $path=$result->data->fileUrlPath;
        if($path) $path=Regex::Replace($path,"~^/storage/images/~","/images/");



        //返回文件ID
        return ReturnResult::Success($path);

    }

    public function GetBusinessName()
    {
        return "图片上传";
    }


}